package cn.chenddcoder.handler;

import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ChatReply {
    private int code;
    private String message;
    public ChatReply(CommandCodeEnum commandCodeEnum){
        this.code=commandCodeEnum.getCode();
        this.message=commandCodeEnum.getMessage();
    }

    public static String ok() {
        return JSONUtil.toJsonStr(new ChatReply(CommandCodeEnum.OK));
    }
    public static String error() {
        return JSONUtil.toJsonStr(new ChatReply(CommandCodeEnum.ERROR));
    }
}
